const os = require('os');

// 获取所有网络接口信息
const networkInterfaces = os.networkInterfaces();

console.log('Network Interfaces:');
console.log('-------------------');

// 遍历每个网络接口
Object.keys(networkInterfaces).forEach((interfaceName) => {
  const interfaceData = networkInterfaces[interfaceName];

  console.log(`Interface: ${interfaceName}`);
  interfaceData.forEach((info) => {
    console.log(`ip地址: ${info.address}`);
    console.log(`Netmask: ${info.netmask}`);
    console.log(`MAC Address: ${info.mac}`);
    console.log(`Internal: ${info.internal}`);
    console.log('-------------------');
  });
});
